#include "stdafx.h"
#include "mytime.h"
#include <iostream>


mytime::mytime(void)
{
	hours = minutes =0;
}


mytime::~mytime(void)
{

}

mytime::mytime(int h,int m){
	hours = h;
	minutes = m;
}
void mytime::AddMin(int m){
	minutes += m;
	hours += minutes/60;
	minutes %= 60;
}
void mytime::AddHr(int h){
	hours += h;
}
void mytime::Reset(int h,int m){
	hours = h;
	minutes= m;
}
mytime mytime::Sum(const mytime &t)const{
	mytime sum;
	sum.minutes = minutes +t.minutes;
	sum.hours = hours + t.hours + sum.minutes / 60;
	sum.minutes = sum.minutes % 60;
	return sum;
}
void mytime::show()const{
	std::cout << hours <<" hours." << minutes <<"minutes";
}

mytime mytime:: operator +(const mytime &t)const{
	mytime sum;
	sum.minutes = minutes +t.minutes;
	sum.hours = hours + t.hours + sum.minutes / 60;
	sum.minutes = sum.minutes % 60;
	return sum;
}
